class Solution {
    public:
        vector<vector<int> > flipChess(vector<vector<int> >& A, vector<vector<int> >& f) {
                    int dx[4] = {0, 0, -1, 1};
                            int dy[4] = {1, -1, 0, 0};
                                    for(auto& e : f)    // 简单模拟
                                            {
                                                            int sr = e[0] - 1, sc = e[1] - 1;
                                                                        for(int i = 0; i < 4; ++i)
                                                                                    {
                                                                                                        int x = dx[i] + sr, y = dy[i] + sc;
                                                                                                                        if(x >= 0 && x < 4 && y >= 0 && y < 4)
                                                                                                                                        {
                                                                                                                                                                if(A[x][y] == 0)
                                                                                                                                                                                        A[x][y] = 1;
                                                                                                                                                                                                            else
                                                                                                                                                                                                                                    A[x][y] = 0;
                                                                                                                                        }
                                                                                    }
                                            }
                                                    return A;
        }
};
                                                                                                                                        }
                                                                                    }
                                            }
        }
}